# Pull base image
FROM jrottenberg/ffmpeg:4.0-ubuntu
USER root
MAINTAINER Gonsin

RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install
ENV TZ=Asia/Shanghai
ENV LANG C.UTF-8

## 安装通用的vim、wget工具，用于日后维护
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bk
COPY sources.list /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y vim
RUN apt-get install -y wget

## 安装java
RUN wget http://update.gonsincloud.com/v/jre-8u231-linux-x64.tar.gz
RUN tar zxvf jre-8u231-linux-x64.tar.gz -C /usr/local/
ENV JAVA_HOME /usr/local/jre1.8.0_231
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH $PATH:$JAVA_HOME/bin
RUN java -version

## 安装aapt
RUN wget http://update.gonsincloud.com/v/apktool
RUN wget http://update.gonsincloud.com/v/apktool_2.3.3.jar
RUN wget http://update.gonsincloud.com/v/aapt
RUN mkdir /usr/local/apktool
RUN mv apktool_2.3.3.jar apktool.jar
RUN mv apktool apktool.jar aapt /usr/local/apktool
RUN chmod 777 /usr/local/apktool/apktool /usr/local/apktool/apktool.jar /usr/local/apktool/aapt
RUN apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32z1
ENV AAPT_HOME /usr/local/apktool
ENV PATH $PATH:$AAPT_HOME

## 无纸化项目
# ADD target/paperless_server_v3-3.0-SNAPSHOT-release-3.0-SNAPSHOT.tar.gz /home/gonsin/paperless
 ADD target/${项目生成tar.gz文件名} /home/gonsin/${项目名字}

## 启动项目
ENTRYPOINT ["sh", "/home/gonsin/${项目名字}/${项目生成tar.gz解压之后的文件夹名字}/bin/startup.sh"]

WORKDIR /home/gonsin